Skip to content

Comments

fix double experiment directory creation during training#46

Open
maedmatt wants to merge 3 commits intoamazon-far:mainfrom
maedmatt:fix/double-experiment-dir
Open

fix double experiment directory creation during training#46
maedmatt wants to merge 3 commits intoamazon-far:mainfrom
maedmatt:fix/double-experiment-dir

Conversation

@maedmatt
Copy link
Contributor

@maedmatt maedmatt commented Feb 6, 2026

Issue

Issue is described in #44

Fix

Pass the experiment_dir computed in train_agent.py through EnvConfig to base_task.py instead of having base_task.py compute its own. Added an optional experiment_dir: str | None = None field to EnvConfig. Other callers (replay, eval, tests) that don't pass it get the existing fallback behavior.

Test plan

  • ruff check passes
  • mypy passes (no new issues)
  • Full test suite passes (151 passed, 2 skipped)
  • Smoke test: python -m holosoma.train_agent exp:g1-23dof --algo.config.num_learning_iterations=5 creates exactly one directory

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@clayrosenthal
Copy link
Contributor

Hey @maedmatt can you try and rebase this? We've updated the static check CI test to output the diff after pre-commit has been run. Perhaps the version of ruff you ran differs from the version ran in CI.

@clayrosenthal clayrosenthal added the bug Something isn't working label Feb 17, 2026
if tyro_config.experiment_dir is not None:
experiment_dir = Path(tyro_config.experiment_dir)
else:
from holosoma.utils.experiment_paths import get_experiment_dir, get_timestamp # noqa: PLC0415
Copy link
Contributor

@clayrosenthal clayrosenthal Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you import this at the top of the file? Looks like we didn't before, but unsure why we wouldn't.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've moved the top-level import in 34c243a

@maedmatt maedmatt force-pushed the fix/double-experiment-dir branch from dfa11ca to 34c243a Compare February 18, 2026 08:46
@maedmatt
Copy link
Contributor Author

Hey @clayrosenthal, I've rebased into main and moved the import to the top of the file.

Let me know if I have to adjust something else!

@clayrosenthal
Copy link
Contributor

clayrosenthal commented Feb 19, 2026

@maedmatt Still seems to be failing the pre-commit ruff checks, have you installed and ran the pre-commit hooks locally? I just merged a PR to try and display the diff for the auto-fix, but you may need to rebase once more to see that

If you have already installed the pre-commit hooks, which version of pre-commit are you running and which version of python? We may need to more clearly document the expected versions

base_task.py was calling get_timestamp() independently, creating a
second experiment directory a few seconds after train_agent.py. Now
train_agent.py passes its experiment_dir through EnvConfig so both use
the same directory.
@maedmatt maedmatt force-pushed the fix/double-experiment-dir branch from 34c243a to 766fc16 Compare February 19, 2026 21:16
@maedmatt
Copy link
Contributor Author

Hey @clayrosenthal, I've rebased it again, let me know if it works now!

This is what I have: python 3.8.20, pre-commit 3.5.0, ruff v0.11.8. But isn't the version fixed by .pre-commit-config.yaml?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants